#include <bits/stdc++.h>
using namespace std;
const int N = 25;
typedef long long LL;

LL f[N];

int main()
{
	int n; cin >> n;
	f[2] = 1;
	for(int i = 3;i <= n;i ++) f[i] = (i - 1) * (f[i - 1] + f[i - 2]);
	cout << f[n] << endl;
	return 0;
}